import React from 'react'
export default class App extends React.Component {
    constructor(props) {
        super(props)
        console.log('props', props)
        this.state = {
            content: '',
            x: 0,
            y: 0
        }
    }

    move1 = (e) => {
        this.setState({
            x: e.clientX,
            y: e.clientY
        })
    }

    componentDidMount() {
        window.addEventListener('mousemove', this.move1)
    }
    //   b1={(a)=><p>鼠标当前位置 {a.x}---{a.x}</p>}
    render() {
        // return (
        //     <div>
        //         <h1>x {this.state.x}</h1>
        //         <h1>y {this.state.y}</h1>

        //     </div>
        // )
        // return this.props.b1(this.state)

        // b1 = {(a)=> <div><img
        //     src='https://ftp.bmp.ovh/imgs/2021/06/0b6cb6a38f3fdde5.png' 
        //     style={{
        //       position:'absolute',
        //       top:a.y-100,
        //       left:a.x-100
        //     }}
        //    /></div>}

        return (
            <div>
                <h1>
                    {this.state.x}--{this.state.y}
                </h1>
                {this.props.b1(this.state)}

            </div>
        )
    }
}